﻿@using System.Globalization
@model Project.Domain.Entities.Match
@{   
    var controller = ViewContext.Controller.ValueProvider.GetValue("controller").RawValue.ToString();
    ViewBag.Title = "Modify" + controller.ToString(CultureInfo.InvariantCulture);
    var id = Convert.ToInt32(ViewBag.Id);
}

@{
    ViewBag.Title = "Modify" + controller.ToString();
}
<script type="text/javascript">
    $(document).ready(function() {
        $('#date').datepicker({
            changeMonth: true,
            changeYear: true,
            dateFormat: 'dd-mm-yy',
            yearRange: '2011:2050'
        });
    });
    function save() {
        var options = {
            beforeSubmit: showRequest,  // pre-submit callback 
            success: showResponse  // post-submit callback 
        };
        $('#homeScore').val();
        $('#awayScore').val();
        $('#frmManagement').ajaxSubmit(options);
    }

    function showRequest(formData, jqForm, options) {
        var form = jqForm[0];
        if (form.homeScore.value == '') {
            alert('Vui lòng điền đầy đủ thông tin.');
            return false;
        }
        if (form.awayScore.value == '') {
            alert('Vui lòng điền đầy đủ thông tin.');
            return false;
        }
    }

    function showResponse(responseText, statusText, xhr, $form) {
        if (responseText == '1') {
            var url = root + "Admin/" + "@controller.ToString()" + "/#/EndPlay";
            location.href = url;
        }
    }
</script>
<div class="table">
    <div class="head_table">
        <div class="head_title_edit">@Model.HomeTeam.TeamName vs @Model.AwayTeam.TeamName</div>
    </div>
	<div class="clearAll"></div>
	@using (Html.BeginForm("EndPlay", "Match", FormMethod.Post, new { id = "frmManagement" }))
 {
     <input type="hidden" value="@ViewBag.Id" name="hiddenIdAdmincp" />                              
     <div class="row_text_field_first">
         <table cellspacing="0" cellpadding="0" border="0" width="100%">
             <tr>
                 <td class="left_text_field">HomeScore:</td>
                 <td class="right_text_field">
                     <input type="text" name="homeScore" value=" " id="homeScore" style="width: 200px;"/>
                 </td>                 
             </tr> 
         </table>
     </div>    
     <div class="row_text_field">
         <table cellspacing="0" cellpadding="0" border="0" width="100%">
             <tr>                 
                 <td class="left_text_field">AwayScore:</td>
                 <td class="right_text_field">
                     <input type="text" name="awayScore" id="awayScore" value=" " style="width: 200px;"/>
                 </td>
             </tr> 
         </table>
     </div>                          
 }
</div>